package com.amos.wx.web;

import com.amos.wx.entity.TAccount;
import com.amos.wx.dao.AccountRepostory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Optional;

/**
 * @author Amos
 * @ClassName TestController
 * @Description TODO
 * @Date 2018/11/22 22:01
 * @VERSION 1.0
 **/
@RestController
@RequestMapping("/test")
public class TestController {
    private final static Logger logger = LoggerFactory.getLogger(TestController.class);
    @Autowired
    private AccountRepostory accountRepostory;
    @GetMapping("/getAccout/{id}")
    public TAccount getAccount(@PathVariable("id")String id){
        logger.info("获取的参数为：{}",id);
        Optional<TAccount> account = accountRepostory.findById(id);
        return account.get();
    }

}
